#include "widget.h"
#include "ui_widget.h"
#include <QPainter>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::paintEvent(QPaintEvent *event)
{
    (void)event;
    //实例化绘画者
    QPainter painter(this);

//    painter.translate(100,100);
    QPixmap map(":/cm.png");
    painter.translate(215,215);
    painter.rotate(180);
    painter.translate(-215,-215);
    painter.drawPixmap(0,0,map);
//    qDebug()<<map;

//    painter.drawPixmap(0,0,map);
//    painter.drawPixmap(0,0,800,600,map);
//    painter.drawPixmap(0,0,200,100,map);
    //首先将绘画者的坐标调到图片的中心点
//    painter.translate(100,50);
//    painter.rotate(180);
//    painter.translate(-100,50);
//    painter.drawPixmap(0,0,200,100,map);
}

